<%--@elvariable id="webRoot" type="com.doupi.partner.op.interceptor.OpFilter"--%>
<%--@elvariable id="type" type="com.doupi.partner.op.controller.user.UserController.index"--%>

<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../common/tags.jsp" %>

<!DOCTYPE html>
<html>
<head lang="en">
    <%@include file="../common/assets.jsp" %>
</head>
<body>
<!-- header -->
<%@include file="../common/header.jsp" %>

<!-- main start -->
<div class="am-cf admin-main">
    <!-- sidebar start -->
    <%@include file="../common/menu.jsp" %>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">

        <div class="am-cf am-padding">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">用户管理</strong> /
                <small>
                    ${util:getUserTypeByCode(type).name}
                </small>
            </div>
        </div>

        <div class="am-g">

            <div class="am-u-sm-12 am-u-md-6 am-text-left">
                <%-- <util:wholePermission name="user:1:add">
                     <a href="${webRoot}/user/${type}/edit/0" class="am-btn am-btn-default">添加</a>
                 </util:wholePermission> <util:logicPermissionTag name="!user:1:add"> &nbsp; </util:logicPermissionTag>--%>
            </div>
            <div class="am-u-sm-12 am-u-md-6">
                <%--<div class="am-form-group" style="float: right; width: 200px; margin-right: 5px;">
                    <div class="am-input-group am-input-group-sm">
                        <input type="text" class="am-form-field" id="searchKey" placeholder="请输入用户昵称">
                        <span class="am-input-group-btn">
                            <button class="am-btn am-btn-default" type="button"
                                    onclick="searchUser();">搜索</button>
                        </span>
                    </div>
                </div>--%>
            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table width="100%"
                                class="am-table am-table-striped am-table-bordered am-table-compact am-text-nowrap"
                                id="list_table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>昵称</th>
                                <th>头像</th>
                                <th>关注时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </form>
                </div>

            </div>
        </div>
    </div>
    <!-- main end -->

    <!-- foot -->
    <%@include file="../common/footer.jsp" %>

    <script type="text/javascript">
        var BUSINESS_TABLE;
        $(function () {
            //表格初始化
            BUSINESS_TABLE = initDataTable(
                {
                    ajax: '${webRoot}/user/${type}/list',
                    columns: [
                        'id',
                        {
                            data: 'nickname',
                            render: function (v) {
                                return v || '用户设置隐藏';
                            }
                        },
                        {
                            data: 'headImgUrl',
                            render: function (v) {
                                if (v) {
                                    return '<img src="' + v + '" style="width:50px; height:50px;" />';
                                }
                                return '用户设置隐藏';
                            }
                        },
                        'createTime'
                    ]
                }, function () { //搜索参数JSON数据
                    return {
                        nickname: $('#searchKey').val()
                    };
                });
        });

        //搜索
        /*function searchUser() {
         BUSINESS_TABLE.draw();
         }*/
    </script>
</body>
</html>